<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
	<title>权限编辑</title>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<link rel="stylesheet" href="/static/css/role_permission.css">
	<jsp:include page="/WEB-INF/views/common/link.jsp" />
	<script src="/static/js/system/role_permission.js"></script>
</head>
<body class="hold-transition skin-blue sidebar-mini">
	<div class="wrapper">
		<%@include file="/WEB-INF/views/common/navbar.jsp"%>
		<!--菜单回显-->
		<c:set var="currentMenu" value="role" />
		<%@include file="/WEB-INF/views/common/menu.jsp"%>
		<div class="content-wrapper">
			<section class="content-header">
				<h1>权限编辑</h1>
			</section>
			<section class="content">
				<div class="box container">
					<div class="row">
						<div class="col-sm-6 leftPermission">
							<label class="control-label"> 权限列表  双击[+]</label>
							<c:forEach var="m" items="${leftModuleList}">
								<div class="panel panel-default">
									<div class="panel-heading">
										<h4 class="panel-title">
											<a data-toggle="collapse" data-parent="#accordion" href="#${m.id}" class="fa-angle-ld">
												<div class="font_left" style="display: block">${m.name}<i class="fa fa-angle-left pull-right"></i></div>
												<div class="font_down" style="display: none">${m.name}<i class="fa fa-angle-down pull-right"></i></div>
											</a>
										</h4>
									</div>
									<div id="${m.id}" class="panel-collapse collapse out">
										<div class="panel-body">
											<table class="col-sm-10 tableClz" id="tbModuleId${m.id}">
												<c:forEach var="p" items="${m.permissionList}">
													<tr class="trTdClz" id="leftTrId${p.id}">
														<td style="width: 50%">${p.name}</td>
														<td>${p.expression}</td>
													</tr>
												</c:forEach>
											</table>
											<select class="col-sm-1 leftSelect" multiple  size="${m.permissionList.size()}" id="stModuleId${m.id}">
												<c:forEach var="p" items="${m.permissionList}" varStatus="vs">
													<option data-mid="${m.id}" data-pid="${p.id}" class="option-btn option-btn-add" value="${p.id}">+</option>
												</c:forEach>
											</select>
											<div class="col-sm-1 btn-addAll">
												<button class="btn btn-primary btn-addAll-buttion">+</button>
											</div>
										</div>
									</div>
								</div>
							</c:forEach>
						</div>
						<div class="col-sm-6 rightPermission">
							<form class="form-horizontal" action="/permission/authorizeForRole"
								  method="post" id="editForm">
								<label class="control-label">${role.name} 现有权限 双击[-]</label>
								<input type="hidden" name="roleId" value="${role.id}">
								<div class="form-group" style="margin-top: 10px;">
									<div class="col-sm-8">
                                        <table class="col-sm-11 tableClz" id="authorizeTable">
                                            <c:forEach var="p" items="${role.permissionList}">
												<tr class="trTdClz" id="rightTrId${p.id}">
													<td style="width: 50%">${p.name}</td>
													<td>${p.expression}</td>
												</tr>
											</c:forEach>
                                        </table>
										<select name="pId" class="col-sm-1 select rightSelect" id="authorizeSelect" multiple="multiple" size="${role.permissionList.size()}">
											<c:forEach var="p" items="${role.permissionList}">
												<option data-mid="${p.module.id}" data-pid="${p.id}" class="option-btn option-btn-rm" value="${p.id}"> - </option>
											</c:forEach>
										</select>
									</div>
								</div>
								<div class="form-group">
									<div class="col-sm-8">
										<button id="submitBtn" type="button" class="btn btn-primary">保存</button>
									</div>
								</div>
							</form>
						</div>
					</div>
				</div>
			</section>
		</div>
		<%@include file="/WEB-INF/views/common/footer.jsp"%>
	</div>
</body>
</html>
